package operation;
import Book.Book;
import Book.BookList;
import java.util.Scanner;
public class ReturnOperation implements Ioperation{
    public void work(BookList bookList){
        System.out.println("归还图书");
        System.out.println("请输入你要归还的书名");
        Scanner scanner=new Scanner(System.in);
        String name=scanner.nextLine();
        int current= bookList.getUseSize();
        for (int i = 0; i < current; i++) {
            Book book=bookList.getBook(i);
            if(book.getName().equals(name)){
                bookList.getBook(i).setBoorowed(false);
                System.out.println("归还成功");
                return;
            }
        }
        System.out.println("不存在这本书，无法归还");
    }
}
